@extends('admin.public')

@section('content')
    <div class="col-md-12">
        <form data-validate="parsley" method="post">
            {!! csrf_field() !!}
            <input type="hidden" name="id" value="{{ $field->id }}">
            <section class="panel panel-default">
                <header class="panel-heading">
                    {{ $frame['title'] }}
                    <a href="{{ route('admin.message.field') }}" class="btn btn-xs btn-default pull-right">留言设置</a>
                </header>
                <div class="panel-body">
                    <div class="form-group">
                        <label>字段名称</label>
                        <input type="text" class="form-control parsley-validated" data-required="true" name="name"
                               placeholder="请填写字段名称" value="{{ $field->name }}">
                    </div>
                    <div class="form-group pull-in clearfix">
                        <div class="col-sm-6">
                            <label>绑定字段</label>
                            <div class="clearfix"></div>
                            <select style="width:100%" class="chosen-select" name="field">
                                @foreach( $fields as $f )
                                    <option value="{{ $f }}" {{ $field->field == $f?'selected':'' }}>{{ $f }}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="col-sm-6">
                            <label>字段别名
                                <small class="text-small">字段别名用于前台在线留言表单中的字段,请慎重填写!</small>
                            </label>
                            <input type="text" class="form-control parsley-validated" name="alias" data-required="true"
                                   placeholder="请填写字段别名" value="{{ $field->alias }}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label>字段值
                            <small class="text-small">多个值可以用','标记分隔,一般用于
                                <span class="text-info">单选框</span>,
                                <span class="text-info">复选框</span>,
                                <span class="text-info">下拉菜单</span>!
                            </small>
                        </label>
                        <input type="text" class="form-control parsley-validated" name="value"
                               placeholder="请填写字段的值" data-required="true" value="{{ $field->value }}">
                    </div>
                    <div class="form-group">
                        <label>字段验证规则</label>
                        <input type="text" class="form-control parsley-validated"
                               placeholder="请填写字段验证规则" data-required="true" name="verify" value="{{ $field->verify }}">
                    </div>
                    <div class="checkbox i-checks">
                        <label>
                            <input type="checkbox" name="status" {{ (bool)$field->status?'checked':'' }}
                            class="parsley-validated"><i></i> 勾选此项,即开启本设置
                        </label>
                    </div>
                    <div class="checkbox i-checks">
                        <label>
                            <input type="checkbox" name="show" {{ (bool)$field->show?'checked':'' }}
                            class="parsley-validated"><i></i> 勾选此项,即可在前台留言列表中显示
                        </label>
                    </div>
                </div>
                <footer class="panel-footer text-right bg-light lter">
                    <button type="submit" class="btn btn-success btn-s-xs">保存</button>
                </footer>
            </section>
        </form>
    </div>
@endsection

@section('css')
    <link rel="stylesheet" href="/public/theme/js/chosen/chosen.css" type="text/css"/>
@endsection

@section('js')
    <!-- Chosen -->
    <script src="/public/theme/js/chosen/chosen.jquery.min.js"></script>
@endsection